Skip to content

Conversation

@debermudez
Copy link
Contributor

@debermudez debermudez commented Jan 23, 2026

Summary by CodeRabbit

  • Tests
    • Added integration tests validating Mooncake trace dataset handling across multiple formats including structured traces, text-input traces, and multi-turn session traces
    • Introduced test utility functions for Mooncake trace file generation to support testing infrastructure

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions
Copy link

github-actions bot commented Jan 23, 2026

Try out this PR

Quick install:

pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@75ffee6a5a660e95f31d6b1b3971afde35f2982a

Recommended with virtual environment (using uv):

uv venv --python 3.12 && source .venv/bin/activate
uv pip install --upgrade --force-reinstall git+https://github.com/ai-dynamo/aiperf.git@75ffee6a5a660e95f31d6b1b3971afde35f2982a

Last updated for commit: 75ffee6Browse code

@github-actions github-actions bot added the test label Jan 23, 2026
@codecov
Copy link

codecov bot commented Jan 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@debermudez debermudez force-pushed the dbermudez/aip-659-add-mooncake-integration-test branch from a628ec6 to 1e5900a Compare January 24, 2026 00:09
Copy link
Contributor

@ajcasagrande ajcasagrande left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, just a few notes

@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

Walkthrough

A new integration test module for the mooncake_trace custom dataset type is introduced, along with a utility helper function. The test module contains three integration tests validating different Mooncake trace input formats: structured traces with input/output lengths, text-input traces, and multi-turn sessions with session IDs.

Changes

Cohort / File(s) Summary
New integration test module
tests/integration/test_mooncake_trace.py
Adds TestMooncakeTraceIntegration class with three test methods covering basic input_length traces, text-input traces, and multi-turn session traces; validates requested_count and output production against mock server.
Test utilities
tests/integration/utils.py
Introduces create_mooncake_trace_file() helper function to generate Mooncake trace JSONL files from trace dictionaries for test fixture setup.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Hopping with traces through tests so fine,
Mooncake data dancing in each line,
Multi-turn sessions and inputs unite,
New assertions shine bold and bright!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding integration tests for the mooncake trace custom dataset type.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@tests/integration/test_mooncake_trace.py`:
- Around line 63-69: The test constructs the list variable traces with entries
containing "text_input" but omits required "hash_ids", causing MooncakeTrace
validation failures; update each dictionary in traces (the list defined as
traces) to include a corresponding "hash_ids" field (e.g., an array or dict
matching the expected MooncakeTrace shape) for every entry that has
"text_input", ensuring the values match the test expectations or use stable
placeholders that satisfy validation.
🧹 Nitpick comments (3)
tests/integration/utils.py (1)

17-36: Avoid blocking file I/O in async test helpers.

This helper performs synchronous disk writes; to align with async I/O guidance, consider making it async and offloading the write to a thread (also allows writing bytes in one call). Callers will need to await it. As per coding guidelines, ...

♻️ Suggested refactor
+import asyncio
 import base64
 import subprocess
 from pathlib import Path
@@
-def create_mooncake_trace_file(
+async def create_mooncake_trace_file(
     tmp_path: Path,
     traces: list[dict],
     filename: str = "traces.jsonl",
 ) -> Path:
@@
     """
     trace_file = tmp_path / filename
-    with open(trace_file, "w") as f:
-        for trace in traces:
-            f.write(orjson.dumps(trace).decode("utf-8") + "\n")
+    lines = b"".join(orjson.dumps(trace) + b"\n" for trace in traces)
+    await asyncio.to_thread(trace_file.write_bytes, lines)
     return trace_file
tests/integration/test_mooncake_trace.py (2)

15-18: Consider parametrizing the three Mooncake trace scenarios.

The three test methods share a near-identical CLI invocation; a single parametrized test would reduce duplication and make it easier to add more trace formats. As per coding guidelines, ...


20-25: Add explicit return type hints for async tests.

Please annotate async test methods with -> None (and apply to the other two methods as well). As per coding guidelines, ...

✏️ Example update
-    async def test_basic_mooncake_trace_with_input_length(
+    async def test_basic_mooncake_trace_with_input_length(
         self,
         cli: AIPerfCLI,
         aiperf_mock_server: AIPerfMockServer,
         tmp_path: Path,
-    ):
+    ) -> None:

@debermudez debermudez enabled auto-merge (squash) January 24, 2026 00:58
Copy link
Contributor

@ajcasagrande ajcasagrande left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great job

@debermudez debermudez merged commit 45ec926 into main Jan 24, 2026
18 checks passed
@debermudez debermudez deleted the dbermudez/aip-659-add-mooncake-integration-test branch January 24, 2026 00:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants